//gamestate.h : Defines an interface for creating game states that work with the state manager
//$Id: GameState.h 6 2009-07-27 17:38:52Z brwarner2 $

#pragma once

class CStateManager;

//Interface for all game states
class IGameState
{
public:
	IGameState(void) : m_pParent(0), m_bPaused(false) {}
	virtual ~IGameState(void) {}

	//Called when the state is put onto the stack
	virtual void OnEnter( const std::string &prev ) { m_bPaused = false; }
	
	//Called when the state is taken off the stack
	virtual void OnExit( const std::string &next ) { m_bPaused = false; }

	//Called when the state is being paused
	virtual void OnSuspend( const std::string &next ) { m_bPaused = true; }

	//Called when the state has been activated from pause
	virtual void OnResume( const std::string &prev ) { m_bPaused = false; }

	//Called to render the state
	virtual void Render( void ) = 0;

	//Called to update the state
	virtual void Update( float fElapsed, float fTotal ) {}

	//Called when the state recieves a message
	virtual void Notify( const std::string &msg, int nArg, const boost::any &pArg ) {}
	
	//Sets the state's parent
	void SetParent( CStateManager* pParent ) { m_pParent = pParent; }

protected:
	//The parent state manager
	CStateManager* m_pParent;

	//If the state has been paused
	bool m_bPaused;
};
